<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
登陆
<input id="button" type="button" value="test">

<form action="/auth" method="post">
    <table>
        <tr>
            <td>用户名:</td>
            <td><input type="text" name="username"></td>
        </tr>
        <tr>
            <td>密码:</td>
            <td><input type="password" name="password"></td>
        </tr>
        <tr>
            <td>图形验证码:</td>
            <td>
                <input type="text" name="code">
                <img src="/imageCode">
            </td>
        </tr>
        <tr>
            <td colspan="2"><button type="submit">登录</button></td>
        </tr>

    </table>
</form>
</body>
<script src="/jquery.min.js"></script>
<script type="text/javascript">

    $("#button").click(function () {

        $.ajax({
            url: '/test',
            type: 'get',
            success: function (response) {
                alert(response.data)
            },
            error: function (xhr, status) {
                alert(xhr.status + "  " + xhr.responseJSON.data)
            }
        });

    });

</script>

</html>